<template>
	<view class="container">
			<input v-model="text" /><button @click="sends">发送</button>
	</view>
	<view>{{
		MsgStore.ai[MsgStore.ai.length-1].data.content
	}}</view>
</template>

<script setup>
	import {ref,watch} from "vue"
	import {sendSocketMessage} from "@/utils/ws.js"
	import { useMessageStore } from "../../stores/message"
	const MsgStore = useMessageStore()
	const text = ref("")
	function sends(){
		console.log(text.value)
		sendSocketMessage({type:"ai",content:text.value})
	}
	watch(()=>MsgStore.ai,()=>{
		console.log(MsgStore.ai[MsgStore.ai.length-1],21)
	},{
		deep:true
	})
</script>

<style scoped>
</style>